# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://docs.scrapy.org/en/latest/topics/item-pipeline.html
import csv

# useful for handling different item types with a single interface
from itemadapter import ItemAdapter


class FmPipeline:
    csv_headers = ['排名', '图片链接', '名字', '内容', '浏览量']
    g = open('./Qingting.csv', 'w', encoding='utf-8')
    g_csv = csv.writer(g)
    g_csv.writerow(csv_headers)
    def process_item(self, item, spider):
        print('=========>', item)
        self.g_csv.writerow(item.values())